#include "../serverPool.h"
int remove_file(const char *filename)
{
    int ret = 0;
    if (access(filename, F_OK) != 0 || filename == NULL)
    {
        printf("文件不存在：%s,或文件名为空\n", filename);
        return -1;
    }
    struct stat file_stat;
    if (stat(filename, &file_stat) == -1)
    {
        perror("查询文件信息失败");
        return -2;
    }
    if (S_ISDIR(file_stat.st_mode))
    {
        rm_dir(filename);
    }
    else if (S_ISREG(file_stat.st_mode))
    {
        ret = unlink(filename);
        ERROR_CHECK(ret, -4, "unlink failed");
    }
    return 0;
}
